// package: learn-go
// filename: main
// author: Administrator@gmail.com
// time: 2023/8/17 16:44
package main

import "fmt"

type Persona struct {
	Name string
	Age  int
}

type Studenta struct {
	Person *Persona
	Grade  int
	Age    int
}

func main() {
	p := Persona{
		Name: "Tom",
		Age:  18,
	}

	s := Studenta{
		Person: &p,
		Grade:  1,
		Age:    12,
	}

	// 下面这行代码就可以正常访问 Person 的 Age 字段了
	age := s.Person.Age
	fmt.Println(age) // 输出 18

	fmt.Println(s.Age)
}
